import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [

  {
    path: '/login',
    component: () => import('@/views/login/index'),
    meta: { title: '登陆页' }
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    meta: { title: '错误页' }
  },

  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: { title: '首页' }
  },

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404' }
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  scrollBehavior: () => ({ y: 0 }),
  routes
})

export default router
